using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using CHARACTERS;

namespace DIALOGUE {
    [System.Serializable]
    public class NameContainer
    {
        [SerializeField] private GameObject root;
        [field:SerializeField] public TextMeshProUGUI nameText { get; private set; }

        public void Show(string nameToShow = "")
        {
            root.SetActive(true);
            if(nameToShow != string.Empty)
            {
                nameText.text = nameToShow;
            }
        }

        public void Hide()
        {
            root.SetActive(false);
        }

        public void SetTextColorAndFontFromCharacterConfig(CharacterConfigData config)
        {
            nameText.color = config.nameColor;
            nameText.font = config.nameFont;
            nameText.fontSize = config.nameFontSize * DialogueSystem.instance.config.characterConfig.dialogueFontScale;
        }
    }
}
